/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-12
 * Time: 22:17
 */
class Singleton2 {
    private volatile static Singleton2 instance = null;

    public static Singleton2 getInstance() {
        if(instance == null) {
            synchronized (Singleton2.class) {
                if(instance == null) {
                    instance = new Singleton2();
                }
            }
        }

        return instance;
    }

    private Singleton2() {}
}
public class Demo4 {
}
